from playwright.sync_api import sync_playwright
import time
from hamcrest import assert_that, equal_to
# def test_case():
#     print('start case 01')
#     with sync_playwright() as p:
#         browser = p.chromium.launch(headless=False)
#         page = browser.new_page()
#         page.goto('https://www.sogou.com/')
#         print(page.title())
#         page.fill("input[name=\"wd\"]", "web端自动化测试")
#         time.sleep(2)
#         page.click('input[id=\'su\']')
#         time.sleep(2)
#
#     print('case 01 end')
def test_case1():
    print('start case 01')
    with sync_playwright() as p:
        browser = p.chromium.launch(headless=False)
        page = browser.new_page()
        page.goto('https://www.sogou.com/')
        print(page.title())
        assert page.title() == '搜狗搜索引擎 - 上网从搜狗开始'
        page.fill("input[name=\"query\"]", "web端自动化测试")
        time.sleep(2)
        page.click('input[id=\'stb\']')
        time.sleep(2)
        assert page.title()== 'web端自动化测试 - 搜狗搜索'

    print('case 01 end')